﻿using System.Collections.Generic;
using Mitosoft.Definitions.ExtendedBaseValues;

namespace TextFileReaderModule.Interfaces
{
  /// <summary>
  /// Defines the interface to a service able to provide and store comments.
  /// </summary>
  public interface ICommentService
  {
    /// <summary>
    /// Adds the given comment or replaces if the given id already exists.
    /// </summary>
    /// <param name="id">Represents the comment id.</param>
    /// <param name="comment">Represents the comment.</param>
    /// <param name="sourceIndex">Represents the source index.</param>
    void Add(ulong id, string comment, int sourceIndex);

    /// <summary>
    /// Gets the comment being identified by the given id.
    /// </summary>
    /// <param name="id">Identifies the comment to be returned.</param>
    /// <returns>Found comment or null if the comment being identified by
    /// the given id does not exist.</returns>
    string GetComment(ulong id);

    /// <summary>
    /// Gets the comments.
    /// </summary>
    /// <param name="sourceIndex">Represents the source index.
    /// If null, all comments will be returned.</param>
    /// <param name="offset">Offset used to correct the id.</param>
    /// <returns>Found comments.</returns>
    IEnumerable<KeyValuePair<ulong, string>> Comments(int? sourceIndex, ulong offset);

    /// <summary>
    /// Clears all comments.
    /// </summary>
    void Clear();

	  /// <summary>
	  /// Gets whether the comments needs to be saved.
	  /// </summary>
	  IExtendedProperty<bool> NeedsToBeSaved { get; set; }
  }
}
